package cn.ywsj.ywsjmidtier.controller;

import cn.ywsj.ywsjmidtier.entity.VO.InvoiceRecordQueryVo;
import cn.ywsj.ywsjmidtier.entity.VO.InvoiceRecordVo;
import cn.ywsj.ywsjmidtier.service.WechatInvoiceFeign;
import cn.ywsj.ywsjmidtier.utils.JsonObjectUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "发票")
@RestController
@RequestMapping("/wechat/member/invoicemgr")
public class WechatInvoiceController {
    @Autowired
    private WechatInvoiceFeign wechatInvoiceFeign;

    /**
     * 开票维护列表
     * @param invoiceRecordQueryVo
     * @param start
     * @param pageSize
     * @return
     */
    @ApiOperation("开票维护列表")
    @PostMapping("/ajaxinvoicerecordpages")
    public String ajaxinvoicerecordpages(InvoiceRecordQueryVo invoiceRecordQueryVo,Integer start,Integer pageSize){
        return  wechatInvoiceFeign.ajaxinvoicerecordpages(JsonObjectUtil.ObjectToJson(invoiceRecordQueryVo),start,pageSize);
    }

    /**
     * 开票维护修改
     * @param invoiceRecordVo
     * @return
     */
    @ApiOperation("开票维护修改")
    @PostMapping("/updateinvoicerecord")
    public String updateinvoicerecord(InvoiceRecordVo invoiceRecordVo){
        return wechatInvoiceFeign.updateinvoicerecord(JsonObjectUtil.ObjectToJson(invoiceRecordVo));
    }

    /**
     * 新增发票模板
     * @param invoiceRecordVo
     * @return
     */
    @ApiOperation("新增发票模板")
    @PostMapping("/insertinvoicerecord")
    public String insertinvoicerecord(InvoiceRecordVo invoiceRecordVo){
        return wechatInvoiceFeign.insertinvoicerecord(JsonObjectUtil.ObjectToJson(invoiceRecordVo));
    }

    /**
     * 删除发票
     * @param invoiceRecordVo
     * @return
     */
    @ApiOperation("删除发票")
    @PostMapping("/delnvoicerecord")
    public String delnvoicerecord(InvoiceRecordVo invoiceRecordVo){
        return wechatInvoiceFeign.delnvoicerecord(JsonObjectUtil.ObjectToJson(invoiceRecordVo));
    }
}
